﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Happy.ExtentionMethods;

namespace Happy.StateManager
{
    /// <summary>
    /// 状态迁移。
    /// </summary>
    public sealed class Transition<TState, TOperation>
    {
        internal Transition(
            TState sourceState,
            TOperation operation,
            ICondition condition,
            TState targetState)
        {
            sourceState.MustNotNull("sourceState");
            operation.MustNotNull("operation");
            condition.MustNotNull("condition");
            targetState.MustNotNull("targetState");

            this.SourceState = sourceState;
            this.Operation = operation;
            this.Condition = condition;
            this.TargetState = targetState;
        }

        /// <summary>
        /// 源状态。
        /// </summary>
        public TState SourceState { get; private set; }

        /// <summary>
        /// 操作。
        /// </summary>
        public TOperation Operation { get; private set; }

        /// <summary>
        /// 前置条件。
        /// </summary>
        public ICondition Condition { get; private set; }

        /// <summary>
        /// 目标状态。
        /// </summary>
        public TState TargetState { get; private set; }
    }
}
